package com.xpec.c4.db;

import java.util.ArrayList;
import java.util.List;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import com.xpec.c4.db.basic.BasicGameDAO;
import com.xpec.c4.db.hibernate.manager.HibernateManager;

/**
 * 对外的数据库操作
 * 
 * @author Bany
 * 
 */
public class DBAction {

	private static final Log log = LogFactory.getLog(DBAction.class);

	static {
		//kkk
		//abc
		addIndex();
		//aaa
	}

	private static void addIndex() {
		List<String> list = new ArrayList<String>();
		// list.add("ALTER TABLE `mails` ADD INDEX `IDindex`(`ID`),ADD INDEX `mail_receiveUserID_index`(`receiveUserID`),ADD INDEX `mail_sendUserID_index`(`sendUserID`)");
		for (String command : list) {
			try {
				HibernateManager.txBegin();
				BasicGameDAO.execute(command);
				HibernateManager.txCommitFailRollbackClearSession();
				log.info("add index:" + list);
			} catch (Exception e) {
			}
		}
		HibernateManager.clearSession();
	}
}
